﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>

<asp:Content ID="registerHead" ContentPlaceHolderID="head" runat="server">
    <title>Register</title>
</asp:Content>
<asp:Content ID="registerContent" ContentPlaceHolderID="MainContent" runat="server">

    <script type="text/javascript">
        $(document).ready(function() {
            $("#AccountForm").validate({
                rules: {
                    UserName: {
                        required: true
                    },
                    Email: {
                        required: true,
                        email: true
                    },
                    Password: {
                        required: true
                    },
                    ConfirmPassword: {
                        equalTo: "#Password"
                    },
                    FName: {
                        required: true
                    },
                    LName: {
                        required: true
                    }

                },
                messages: {
                    UserName: {
                        required: "UserName cannot be blank"
                    },
                    Email: {
                        required: "Email cannot be blank",
                        email: "Email must be valid"
                    },
                    Password: {
                        required: "Password cannot be blank"
                    },
                    ConfirmPassword: {
                        equalTo: "Confirm Password and Password must be the same"
                    },
                    FName: {
                        required: "First Name cannot be blank"
                    },
                    LName: {
                        required: "Last Name cannot be blank"
                    }
                }
            });
        });
    </script>

    <h3>
        Register</h3>
    <p>
        Use the form below to register a new account.
    </p>
    
    <%= Html.ValidationSummary() %>
    <% using (Html.BeginForm("Register", "Account", FormMethod.Post, new { id = "AccountForm" }))
       { %>
    <div>
        <fieldset>
            <legend>Account Information</legend>
            <p>
                <label for="UserName">
                    Username:</label>
                <%= Html.TextBox("UserName") %>
                <%= Html.ValidationMessage("UserName")%>
            </p>
            <p>
                <label for="Password">
                    Password:</label>
                <%= Html.Password("Password")%>
                <%= Html.ValidationMessage("Password")%>
            </p>
            <p>
                <label for="ConfirmPassword">
                    Confirm password:</label>
                <%= Html.Password("ConfirmPassword")%>
                <%= Html.ValidationMessage("ConfirmPassword")%>
            </p>
            <p>
                <label for="Email">
                    Email:</label>
                <%= Html.TextBox("Email") %>
                <%= Html.ValidationMessage("Email")%>
            </p>
            <p>
                <label for="FName">
                    First Name:</label>
                <%= Html.TextBox("FName")%>
                <%= Html.ValidationMessage("FName")%>
            </p>
            <p>
                <label for="LName">
                    Last Name:</label>
                <%= Html.TextBox("LName")%>
                <%= Html.ValidationMessage("LName")%>
            </p>
            <p>
                <label for="Address1">
                    Slot number or Address:</label>
                <%= Html.TextBox("Address1")%>
                <%= Html.ValidationMessage("Address1")%>
            </p>
            <p>
                <label for="CommunityId">
                    Select community:</label>
                <%= Html.DropDownList("CommunityId", new SelectList(new MVCWeb.Models.HOACRMDataContext().Communities, "CommunityId", "Name"))%>
            </p>
            <p>
                <label for="Options">
                    Select option:</label>
                <select name="Options" id="Options"  >
                    <option value="HomeOwner">HomeOwner</option>
                    <option value="Leaser">Leaser</option>
                </select>
            </p>
            <p>
            <label for="NewsLetter">
                Receive NewsLetter from <%= System.Configuration.ConfigurationManager.AppSettings["SiteName2"] %>:</label>
            <%= Html.CheckBox("NewsLetter")%>
            <%= Html.ValidationMessage("NewsLetter", "*")%>
        </p>
            <p>
                <input type="submit" value="Register" /> <input type="reset" value="Reset" />
            </p>
        </fieldset>
    </div>
    <% } %>
</asp:Content>
